<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="125px">
      <el-form-item label="姓名" prop="storeName">
        <el-input v-model="queryParams.storeName" placeholder="请输入姓名" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="学员编号" prop="storeCode">
        <el-input v-model="queryParams.storeCode" placeholder="请输入学员编号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item label="课程名称" prop="className">
        <el-input v-model="queryParams.className" placeholder="请输入课程名称" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="StudentList" @selection-change="handleSelectionChange">
      <el-table-column label="课程名称" align="center" prop="className" />
      <el-table-column label="门店名称" align="center" prop="storeName" />
      <el-table-column label="门店编号" align="center" prop="storeCode" />
      <el-table-column label="支付订单号" align="center" prop="orderCode" />
      <el-table-column label="已购学时数" align="center" prop="buyLearnTime">
        <template slot-scope="scope">
          {{ scope.row.buyLearnTime }} /时
        </template>
      </el-table-column>
      <el-table-column label="已购学时金额" align="center" prop="payAmount" >
        <template slot-scope="scope">
          {{ scope.row.payAmount }} /元
        </template>
      </el-table-column>
      <el-table-column label="交付学时" align="center" prop="payLearnTime" />
<!--      <el-table-column label="所属学段" align="center" prop="teachSection" />-->
<!--      <el-table-column label="课程等级" align="center" prop="classLevel" />-->
      <el-table-column label="交付学时金额" align="center" prop="jfxsje" >
        <template slot-scope="scope">
          <span  v-if="scope.row.teachSection==0 &&  scope.row.classLevel==0 "> {{ scope.row.payLearnTime*168 }}</span>
          <span  v-if="scope.row.teachSection==0 &&  scope.row.classLevel==1 "> {{ scope.row.payLearnTime*188 }}</span>
          <span  v-if="scope.row.teachSection==1 &&  scope.row.classLevel==0 "> {{ scope.row.payLearnTime*208 }}</span>
          <span  v-if="scope.row.teachSection==1 &&  scope.row.classLevel==1 "> {{ scope.row.payLearnTime*228 }}</span>
          <span  v-if="scope.row.teachSection==2 &&  scope.row.classLevel==0 "> {{ scope.row.payLearnTime*268 }}</span>
          <span  v-if="scope.row.teachSection==2 &&  scope.row.classLevel==1 "> {{ scope.row.payLearnTime*288 }}</span>
        </template>
      </el-table-column>
<!--      /**-->
<!--      * 所属学段：0小学，1初中，2高中-->
<!--      */-->
<!--      private String teachSection;-->
<!--      /**-->
<!--      * 课程等级：0一级，1二级-->
<!--      */-->
<!--      private String classLevel;-->
      <el-table-column label="时间" align="center" prop="createTime" />
      <el-table-column label="学员姓名" align="center" prop="name" />
      <el-table-column label="学员编号" align="center" prop="code" />
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

  </div>
</template>

<script>
import { listStudent, } from "@/api/course/Student";

export default {
  name: "StoreGroup",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 是否显示弹出层
      open: false,
      // 表单参数
      form: {},
      // 交付小组列表
      CoachList: [],
      // 显示搜索条件
      showSearch: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        code: null,
        name: null,
        classTypeId: null,
      },
      // 学员信息表格数据
      StudentList: [],
      PayGroupList: [],
      // 总条数
      total: 0,
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询学员信息列表 */
    getList() {
      this.loading = true;
      listStudent(this.queryParams).then(response => {
        this.StudentList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
  }
};
</script>
